/*
 * File      : bb_except.c
 * This file is part of Black Bird Simulation Platform
 * Copyright 2013-2020 BB(Black Bird) Development Team.  
 * All rights reserved.
 *
 * Change Logs:
 * Date           Author       Notes
 * 2013-10-27    Holt         First Version
 */
#include "bb_except.h"
except_frame_t except_list = NULL;
/*
 * FUNC		:	raise an exception.
 *
 * PARAM1	:	exception number
 * PARAM2	:	in which file the exception happens.
 * PARAM3	:	in which line the exception happens.
 *
 * RETURN 	:	pointer to allocated stack head memory or NULL if 
 *				no free memory was found.
 */
bb_bool except_raise(const bb_except_t e, const char *file,bb_base line) 
{
	except_frame_t p = except_list;
	if (p != NULL)
	{
		p->exception = e;
		p->file = file;
		p->line = line;
		except_list = except_list->prev;
		longjmp(p->env, EXCEPTION_RAISED);
	}
	else
	{
		return bb_FALSE;/* this needs to todo by Holt*/
	}
}